<template>
  <div>
    <button @click="getip1">显示ip</button>
    <span>{{ip}}</span>
  </div>
</template>

<script>
// import { GET_CURRENT_CITY_NAME } from '../../../network/api'
// import {testget} from '../../../network/request'

export default {
    name: 'order',
    data() {
      return {
        ip: ''
      }
    },
    mounted() {
      // console.log(this.getip1)

    },
    methods: {
      getip1() {
        this.ip = localStorage.getItem('Ip')
      },


      // getuserIP(newIP){
      //   let MyPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection
      //   let pc = new MyPeerConnection({
      //     iceServers: []
      //   })
      //   let noop = () => {}
      //   let localIPs = {}
      //   let ipRegex =`/([O-9]{1,3}(.[O-9]{1,3}){3}|[a-fO-9]{1,4}(:[a-fO-9]{1,4}){7})/g`;
        
      //   let iterateIP = (ip) => {
      //     if(!localIPs[ip]) newIP(ip)
      //     localIPs[ip] = true
      //   }

      //   pc.createDataChannel('')

      //   pc.createOffer().then((sdp) => {
      //     sdp.sdp.split('\n').forEach(function(line) {
      //       if(line.indexOf('candidate')<0) return;
      //       line.match(ipRegex).forEach(iterateIP)
      //     })
      //     pc.setLocalDescription(sdp,noop,noop)
      //   }).catch((reason) => {
      //     console.log(reason)
      //   })
      //   pc.onicecandidate = (ice) => {
      //     if(!ice || !ice.candidate || !ice.candidate.candidate || !ice.candidate.candidate.match(ipRegex)) return
      //     ice.candidate.candidate.match(ipRegex).forEach(iterateIP)
      //   }
      // }
    }
}
</script>

<style scoped>

</style>